g1=Show[Graphics[{Pink,Rectangle[]}],DisplayFunction->(PopupWindow[Button["Click here"],#]&)]

g1=Show[Plot[Sin[x],{x,0,2Pi}],DisplayFunction->(PopupWindow[Button["Click here"],#]&)]

g1

Show[Graphics[{Pink,Rectangle[]}],DisplayFunction->CreateDocument]

g2=Show[Plot[Sin[x],{x,0,2Pi}],DisplayFunction->(Print[#];&)]

Show[Plot[Sin[x],{x,0,2Pi}],DisplayFunction->(Print[#];&)];

f[x0_]:=
Module[{x=x0},
While[x>0,x=Log[x]];
Show[Plot[Sin[x],{x,0,2Pi}],DisplayFunction->(Print[#];&)];
If[x==0, Print["zero"], Print["NonZero"]];
x
]

f[4]